union.main.client.cooperation.code={initialize:function(){var a=this;
var b=baidu.g("CodeShowBlock");
elf.dom.Event.add(b,"mouseover",function(c){baidu.addClass(this,"hover")
},function(c){return baidu.dom.hasClass(c,"data-box-row")
});
elf.dom.Event.add(b,"mouseout",function(c){baidu.removeClass(this,"hover")
},function(c){return baidu.dom.hasClass(c,"data-box-row")
});
//baidu.g("InputKeyword").onfocus=function(){if(this.value=="请输入代码位名称"){this.value=""
//}if(!baidu.dom.hasClass(baidu.g("SearchError"),"info")){baidu.addClass(baidu.g("SearchError"),"info")
//}return false
//};
//baidu.g("InputKeyword").onblur=function(){var c=baidu.g("InputKeyword");
//if(c.value==""){c.value="请输入代码位名称"
//}};
//baidu.g("SearchCode").onclick=function(){baidu.g("Keyword").value=baidu.trim(baidu.g("InputKeyword").value);
//a.onSearch()
//};
//baidu.g("FilterStatus").onchange=function(){a.onChangeStatus()
//};
//baidu.g("PageSelectControl").onchange=function(){a.onChangePageSize()
//};
this.pager=new union.lib.Pager({wrapId:"PageControl",onPageChange:function(c){a.onPageChange(c)
},onPerPageChange:function(c){a.onChangePageSize(c)
}});
elf.dom.Event.add(baidu.g("CodeShowBlock"),"click",function(c){a.onOperation(baidu.getAttr(this,"type"),baidu.getAttr(this,"tuid"))
},function(c){return c.nodeName=="Q"&&elf.dom.ClassName.has(c,"open-close")
});
//this.queryData(1,"","",this.getKeyword());
//this.validator=new elf.validation.Validator(this.validRule)
//},getCodeStatus:function(){return baidu.g("FilterStatus").value
//},getKeyword:function(){return baidu.g("Keyword").value
},getPageSize:function(){return baidu.g("PageSelectControl").value
},onSearch:function(){var a=this.validator.validate();
if(!elf.validation.Exit.getResult(a.result)){var c=baidu.q("info error","SearchWrap","p");
c[0].innerHTML=a.error[0].error[0];
baidu.removeClass(c[0],"info");
return false
}var b=this;
this.queryData(1,this.getPageSize(),this.getCodeStatus(),this.getKeyword(),function(d){baidu.g("QueryResult").innerHTML=renderQueryResult({len:d,keyword:b.getKeyword()});
baidu.removeClass("QueryResult","hidden");
baidu.g("DeleteQuery").onclick=function(){baidu.addClass("QueryResult","hidden");
baidu.g("InputKeyword").value="请输入代码位名称";
baidu.g("Keyword").value="";
b.queryData(1,b.getPageSize(),b.getCodeStatus(),"")
}
})
},onChangeStatus:function(){this.queryData(1,this.getPageSize(),this.getCodeStatus(),this.getKeyword())
},onChangePageSize:function(a){this.queryData(1,this.getPageSize(),this.getCodeStatus(),this.getKeyword())
},onPageChange:function(a){this.queryData(a,this.getPageSize(),this.getCodeStatus(),this.getKeyword())
},onOperation:function(b,d){var c=this;
var a=baidu.q("on","PageControl","q");
union.lib.Ajax.loadJSON({url:c.URL_CODE_PREFIX+b+".action",method:elf.net.Ajax.HTTP_POST,data:"page.pageNo="+baidu.getAttr(a[0],"page")+"&page.pageSize="+this.getPageSize()+"&type="+c.getCodeStatus()+"&keyword="+c.getKeyword()+"&tuId="+d,onSuccess:function(e){c.updateData(e)
}})
},queryData:function(c,b,a,d,f){var e=this;
union.lib.Ajax.loadJSON({url:e.URL_CODE_LIST,method:elf.net.Ajax.HTTP_POST,data:"page.pageNo="+c+"&page.pageSize="+b+"&type="+a+"&keyword="+d,onSuccess:function(g){e.updateData(g);
if(f){f(g.page.result.length)
}}})
},updateData:function(a){this.pager.render(a.page.pageNo,a.page.totalPages,a.page.pageSize);
baidu.g("CodeShowBlock").innerHTML=renderCodeTable({page:a.page});
baidu.q("perpage-text","PageControl","span")[0].innerHTML=renderPerpage({page:a.page})
},URL_CODE_LIST:"/client/main/cooperation/adposMgr!getData.action",URL_CODE_PREFIX:"/client/main/cooperation/adposMgr!"};
union.main.client.cooperation.code.validRule={rules:[{field:"inputKeyword",rules:[{method:function(a){return a!=""&&a.trim()!="请输入代码位名称"
},error:"查询条件不能为空！"}]}]};
elf.dom.Event.add(window,"load",function(){union.main.client.cooperation.code.initialize()
});